﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using Microsoft.VisualBasic;

namespace SalePartial.Model
{

    public class XPNewsCommentInfo
    {
        // Methods
        public XPNewsCommentInfo()
        {
            this._CoID = Guid.NewGuid();
            this._NewsID = Guid.Empty;
            this._Content = string.Empty;
            this._CreateDate = DateTime.Now;
            this._CreateTime = DateTime.Now;
            this._UserIP = string.Empty;
        }
        
        public XPNewsCommentInfo(SqlDataReader reader)
        {
            this._CoID = Guid.NewGuid();
            this._NewsID = Guid.Empty;
            this._Content = string.Empty;
            this._CreateDate = DateTime.Now;
            this._CreateTime = DateTime.Now;
            this._UserIP = string.Empty;
            
            this.LoadFromReader(reader);
        }
        
        protected void LoadFromReader(SqlDataReader reader)
        {
            if ((!Information.IsNothing(reader) && !reader.IsClosed))
            {
                this._CoID = reader.GetGuid(0);
                this._NewsID = reader.GetGuid(1);
                this._Content = reader.GetString(2);
                
                if (!reader.IsDBNull(3))
                {
                    this._CreateDate = reader.GetDateTime(3);
                }
                if (!reader.IsDBNull(4))
                {
                    this._CreateTime = reader.GetDateTime(4);
                }
                if (!reader.IsDBNull(5))
                {
                    this._UserIP = reader.GetString(5);
                }
                
            }
        }

        // Properties
        public Guid CoID
        {
            get { return this._CoID ; }
            set { this._CoID = value; }
        }
      
        public Guid NewsID
        {
            get { return this._NewsID; }
            set { this._NewsID = value; }
        }

        public string Content
        {
            get { return this._Content; }
            set { this._Content = value; }
        }
        
        public DateTime CreateDate
        {
            get { return this._CreateDate; }
            set { this._CreateDate = value; }
        }

        public DateTime CreateTime
        {
            get { return this._CreateTime; }
            set { this._CreateTime = value; }
        }

        public string UserIP
        {
            get { return this._UserIP; }
            set { this._UserIP = value; }
        }

        // Fields
        private Guid _CoID;
        private Guid _NewsID;
        private string _Content;
        private DateTime _CreateDate;
        private DateTime _CreateTime;
        private string _UserIP;
    }


}
